package com.pandai.leetcode;

public class Solution206 {
    public ListNode reverseList(ListNode head) {
        if(head == null){
            return null;
        }
        ListNode cur=head;
        ListNode prev = null;
        ListNode tmp = null;
        while(cur!=null){
            tmp = cur.next;
            cur.next = prev;
            prev = cur;
            cur = tmp;
        }
        return prev;
    }
}
